package dto

import "gin/model"

type UserDto struct {
	Uid        int    `json:"uid" gorm:"primaryKey"`
	Openid     string `json:"openid"`
	Nick       string `json:"nickname"`
	AvatarUrl  string `json:"headimgurl" gorm:"column:avatarUrl"`
	Country    string `json:"country"`
	City       string `json:"city"`
	Province   string `json:"province"`
	Gender     int    `json:"sex"`
	CreateTime string `gorm:"column:create_time"`
}

func ToUserDto(user model.UserInfo) UserDto {

	return UserDto{
		Uid:        user.Uid,
		Openid:     user.Openid,
		Nick:       user.Nick,
		AvatarUrl:  user.AvatarUrl,
		Country:    user.Country,
		City:       user.City,
		Province:   user.Province,
		Gender:     user.Gender,
		CreateTime: user.CreateTime,
	}
}
